-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
DOC: Add docs for Series.__invert__ (~); add cross-link from Boolean indexing #62641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…indexing Add dedicated API page for Series.__invert__() so searches for “invert/~” find it.
rhshadrach
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
doc/source/reference/series.rst
Outdated
| .. toctree:: | ||
| :maxdepth: 1 | ||
|
|
||
| api/pandas.Series.__invert__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we follow the rest of the API documentation here:
.. autosummary::
:toctree: api/
Series.__invert__
| @@ -0,0 +1,53 @@ | |||
| .. currentmodule:: pandas | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the request above, this file can be removed. Add anything necessary to the docstring of __invert__ instead.
| For toggling boolean masks with the ``~`` operator, see | ||
| :meth:`pandas.Series.__invert__`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
~ is already mentioned in the paragraph above; I think this can be removed.
| # at bottom of pandas/core/series.py (after class Series ...) | ||
| from pandas.core.ops.docstrings import _doc_series_invert | ||
| Series.__invert__.__doc__ = _doc_series_invert |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can instead add the following to series.py in the Series class:
def __invert__(self) -> Self:
return super().__invert__()Then we can add the docstring there. But I would like a 2nd opinion here, cc @mroeschke.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. It's best to keep docstring with the function definitions
| See Also | ||
| -------- | ||
| Series.__and__, Series.__or__, Series.__xor__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you separate out to one line each, with a short description. See other docstrings in this file for examples.
Series.__invert__()so users searching for “invert/~” can find it.Closes #62516.